package com.xm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xm.mapper.MedicalReportsMapper;
import com.xm.pojo.MedicalReports;
import com.xm.pojo.Memberfiles;
import com.xm.pojo.PageVo;
import com.xm.service.MedicalReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicalReportsServiceImpl implements MedicalReportsService {

    @Autowired
    MedicalReportsMapper mapper;

    public int insertMedicalReportsService(MedicalReports medicalReports) {
        return mapper.insertMedicalReports(medicalReports);
    }

    public int deleteMedicalReportsService(String archive_num) {
        return mapper.deleteMedicalReports(archive_num);
    }

    public int updateMedicalReportsService(MedicalReports medicalReports) {
        return mapper.updateMedicalReports(medicalReports);
    }

    public Memberfiles queryByConditionService(String condition) {
        return mapper.queryByCondition(condition);
    }

    public PageInfo<MedicalReports> queryListService(PageVo pageVo) {
        PageHelper.startPage(pageVo.getCurrentPage(),pageVo.getPageSize());
        List<MedicalReports> medicalReportsList =  mapper.queryList((MedicalReports) pageVo.getEntity());
        PageInfo<MedicalReports> medicalReportsPageInfo=new PageInfo<MedicalReports>(medicalReportsList);
        return medicalReportsPageInfo;
    }

    public List<MedicalReports> queryAllService() {
        return mapper.queryAll();
    }
}
